﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using VNet.VisiSuite.Controls;

namespace VNet.VisiSuite.Controls
{
    public partial class HeaderControl : UserControl
    {
        public static readonly DependencyProperty TitleProperty = DependencyProperty.Register("Title", typeof(string), typeof(HeaderControl), new FrameworkPropertyMetadata(string.Empty, TitleChangedCallback));
        public static readonly DependencyProperty MenuIconsProperty = DependencyProperty.Register("MenuIcons", typeof(IList<VNetMenuItem>), typeof(HeaderControl), new FrameworkPropertyMetadata(null, MenuIconsChangedCallback));

        public HeaderControl()
        {
            InitializeComponent();
            DataContext = this;
        }
        public string Title
        {
            get { return (string)GetValue(TitleProperty); }
            set { SetValue(TitleProperty, value); }
        }

        public IList<VNetMenuItem> MenuIcons
        {
            get { return (IList<VNetMenuItem>)GetValue(MenuIconsProperty); }
            set { SetValue(MenuIconsProperty, value); }
        }


        private static void TitleChangedCallback(DependencyObject d, DependencyPropertyChangedEventArgs e)
        {
            var control = d as HeaderControl;
            control._titleTblk.Text = (string)e.NewValue;
        }

        private static void MenuIconsChangedCallback(DependencyObject d, DependencyPropertyChangedEventArgs e)
        {
            var control = d as HeaderControl;
            //control._menu.Icons = (IList<VNetMenuItem>)e.NewValue;
        }
    }
}
